/**
* @description: 848. 字母移位
* @author hewei
* @date 2022/9/5 14:33
* @version 1.0
*/

public class ShiftingLetters {

    public String shiftingLetters(String s, int[] shifts) {
        long[] sum = new long[shifts.length];
        long temp = 0;
        for (int i = shifts.length - 1; i >= 0; i--) {
            temp += shifts[i];
            sum[i] = temp;
        }
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < sum.length; i++) {
            char c = s.charAt(i);
            stringBuilder.append((char) ((c + sum[i] - 'a') % 26 + 'a'));
        }
        return stringBuilder.toString();
    }
}
